package opencm;

import static org.joda.time.DateTimeConstants.FRIDAY;
import static org.joda.time.DateTimeConstants.MONDAY;
import static org.joda.time.DateTimeConstants.SATURDAY;
import static org.joda.time.DateTimeConstants.SUNDAY;
import static org.joda.time.DateTimeConstants.THURSDAY;
import static org.joda.time.DateTimeConstants.TUESDAY;
import static org.joda.time.DateTimeConstants.WEDNESDAY;

import java.util.Arrays;
import java.util.List;

public enum DiaSemana {
	SEGUNDA_FEIRA("Segunda-Feira", MONDAY), TERCA_FEIRA("Terça-Feira", TUESDAY), QUARTA_FEIRA("Quarta-feira",
			WEDNESDAY), QUINTA_FEIRA("Quinta-feira", THURSDAY), SEXTA_FEIRA("Sexta-feira", FRIDAY), SABADO(
			"Sábado", SATURDAY), DOMINGO("Domingo", SUNDAY);

	private final int dayOfWeek;
	private final String desc;

	DiaSemana(String desc, int dayOfWeek) {
		this.desc = desc;
		this.dayOfWeek = dayOfWeek;

	}

	@Override
	public String toString() {
		return this.desc;
	}

	public int getDayOfWeek() {
		return this.dayOfWeek;
	}

	public static DiaSemana fromDayOfWeek(int dayOfWeek) {
		for (DiaSemana diaSemana : DiaSemana.values()) {
			if (diaSemana.getDayOfWeek() == dayOfWeek) {
				return diaSemana;
			}
		}

		return null;
	}

	public static List<DiaSemana> toList() {
		return Arrays.asList(values());
	}
}